load("@fbcode_macros//build_defs/lib:rust_oss.bzl", "rust_oss")
load("@fbsource//tools/build_defs:rust_binary.bzl", "rust_binary")
load("@fbsource//tools/target_determinator/macros:ci.bzl", "ci")

oncall("scm_server_infra")

rust_binary(
    name = "admin",
    srcs = glob([
        "src/**/*.rs",
    ]),
    autocargo = {"cargo_toml_config": {
        "dependencies_override": {"dependencies": {"sapling-dag-types": {"features": [
            "for-tests",
        ]}}},
        "extra_buck_dependencies": {"dependencies": [
            "//eden/scm/lib/dag:dag",
            "//eden/scm/lib/dag/dag-types:dag-types",
        ]},
    }},
    labels = [
        ci.heavyweight(),
    ],
    named_deps = ({} if rust_oss.is_oss_build() else {"slog": "//common/rust/shed/tracing_slog_compat:tracing_slog_compat"}),
    test_deps = [
        "fbsource//third-party/rust:maplit",
        "//common/rust/shed/fbinit:fbinit-tokio",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//eden/mononoke/repo_factory:test_repo_factory",
        "//eden/mononoke/tests/fixtures:fixtures",
        "//eden/mononoke/tests/utils:tests_utils",
    ],
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:async-stream",
        "fbsource//third-party/rust:bytes",
        "fbsource//third-party/rust:chrono",
        "fbsource//third-party/rust:clap",
        "fbsource//third-party/rust:colored",
        "fbsource//third-party/rust:flate2",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:gix-hash",
        "fbsource//third-party/rust:gix-object",
        "fbsource//third-party/rust:itertools",
        "fbsource//third-party/rust:maplit",
        "fbsource//third-party/rust:prettytable-rs",
        "fbsource//third-party/rust:regex",
        "fbsource//third-party/rust:serde_json",
        "fbsource//third-party/rust:thiserror",
        "fbsource//third-party/rust:tokio",
        "fbsource//third-party/rust:tokio-stream",
        "fbsource//third-party/rust:tokio-util",
        "fbsource//third-party/rust:tracing",
        "fbsource//third-party/rust:walkdir",
        "//common/rust/shed/borrowed:borrowed",
        "//common/rust/shed/bounded_traversal:bounded_traversal",
        "//common/rust/shed/cloned:cloned",
        "//common/rust/shed/facet:facet",
        "//common/rust/shed/fbinit:fbinit",
        "//common/rust/shed/futures_stats:futures_stats",
        "//common/rust/shed/sorted_vector_map:sorted_vector_map",
        "//eden/mononoke/async_requests:async_requests",
        "//eden/mononoke/async_requests:async_requests_client",
        "//eden/mononoke/blobrepo:blobrepo_hg",
        "//eden/mononoke/blobrepo_utils:blobrepo_utils",
        "//eden/mononoke/blobstore:blobstore",
        "//eden/mononoke/blobstore:blobstore_factory",
        "//eden/mononoke/blobstore:cacheblob",
        "//eden/mononoke/blobstore:ephemeral_blobstore",
        "//eden/mononoke/bonsai_git_mapping:bonsai_git_mapping",
        "//eden/mononoke/bonsai_globalrev_mapping:bonsai_globalrev_mapping",
        "//eden/mononoke/bonsai_hg_mapping:bonsai_hg_mapping",
        "//eden/mononoke/bonsai_svnrev_mapping:bonsai_svnrev_mapping",
        "//eden/mononoke/bookmarks:bookmarks",
        "//eden/mononoke/bookmarks:bookmarks_cache",
        "//eden/mononoke/bookmarks:bookmarks_movement",
        "//eden/mononoke/cas_client:cas_client",
        "//eden/mononoke/cas_client:changesets_uploader",
        "//eden/mononoke/changesets/changesets_creation:changesets_creation",
        "//eden/mononoke/cmdlib:cmdlib_cross_repo",
        "//eden/mononoke/cmdlib/commit_id:commit_id",
        "//eden/mononoke/cmdlib/displaying:cmdlib_displaying",
        "//eden/mononoke/cmdlib/displaying/graph:print_graph",
        "//eden/mononoke/cmdlib/mononoke_app:mononoke_app",
        "//eden/mononoke/cmdlib/scrubbing:cmdlib_scrubbing",
        "//eden/mononoke/commit_rewriting/backsyncer:backsyncer",
        "//eden/mononoke/commit_rewriting/live_commit_sync_config:live_commit_sync_config",
        "//eden/mononoke/commit_rewriting/megarepo:megarepolib",
        "//eden/mononoke/commit_rewriting/movers:movers",
        "//eden/mononoke/commit_rewriting/synced_commit_mapping:synced_commit_mapping",
        "//eden/mononoke/common/rust/sql_ext:sql_ext",
        "//eden/mononoke/common/scuba_ext:scuba_ext",
        "//eden/mononoke/common/time_measuring:time_measuring",
        "//eden/mononoke/common/topo_sort:topo_sort",
        "//eden/mononoke/derived_data:blame",
        "//eden/mononoke/derived_data:bulk_derivation",
        "//eden/mononoke/derived_data:case_conflict_skeleton_manifest",
        "//eden/mononoke/derived_data:changeset_info",
        "//eden/mononoke/derived_data:deleted_manifest",
        "//eden/mononoke/derived_data:derived_data_manager",
        "//eden/mononoke/derived_data:fsnodes",
        "//eden/mononoke/derived_data:skeleton_manifest",
        "//eden/mononoke/derived_data:skeleton_manifest_v2",
        "//eden/mononoke/derived_data:unodes",
        "//eden/mononoke/derived_data/content_manifest_derivation:content_manifest_derivation",
        "//eden/mononoke/derived_data/mercurial_derivation:mercurial_derivation",
        "//eden/mononoke/features/commit_transformation:commit_transformation",
        "//eden/mononoke/features/cross_repo_sync:cross_repo_sync",
        "//eden/mononoke/features/redaction:redaction",
        "//eden/mononoke/features/repo_update_logger:repo_update_logger",
        "//eden/mononoke/filenodes:filenodes",
        "//eden/mononoke/filestore:filestore",
        "//eden/mononoke/git/bundle_uri:bundle_uri",
        "//eden/mononoke/git/git_types:git_types",
        "//eden/mononoke/git/packfile:packfile",
        "//eden/mononoke/git/protocol:protocol",
        "//eden/mononoke/git_ref_content_mapping:git_ref_content_mapping",
        "//eden/mononoke/git_source_of_truth:git_source_of_truth",
        "//eden/mononoke/git_symbolic_refs:git_symbolic_refs",
        "//eden/mononoke/manifest:manifest",
        "//eden/mononoke/megarepo_api:megarepo_error",
        "//eden/mononoke/megarepo_api:pushredirect",
        "//eden/mononoke/mercurial:mercurial_mutation",
        "//eden/mononoke/mercurial:mercurial_types",
        "//eden/mononoke/metaconfig:metaconfig_types",
        "//eden/mononoke/mononoke_api:mononoke_api",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/mutable_counters:mutable_counters",
        "//eden/mononoke/mutable_renames:mutable_renames",
        "//eden/mononoke/phases:phases",
        "//eden/mononoke/pushrebase:pushrebase",
        "//eden/mononoke/pushrebase:pushrebase_hooks",
        "//eden/mononoke/pushrebase_mutation_mapping:pushrebase_mutation_mapping",
        "//eden/mononoke/repo_attributes/bonsai_tag_mapping:bonsai_tag_mapping",
        "//eden/mononoke/repo_attributes/commit_graph/commit_graph:commit_graph",
        "//eden/mononoke/repo_attributes/commit_graph/commit_graph_types:commit_graph_types",
        "//eden/mononoke/repo_attributes/commit_graph/preloaded_commit_graph_storage:preloaded_commit_graph_storage",
        "//eden/mononoke/repo_attributes/commit_graph/sql_commit_graph_storage:sql_commit_graph_storage",
        "//eden/mononoke/repo_attributes/repo_blobstore:repo_blobstore",
        "//eden/mononoke/repo_attributes/repo_bookmark_attrs:repo_bookmark_attrs",
        "//eden/mononoke/repo_attributes/repo_cross_repo:repo_cross_repo",
        "//eden/mononoke/repo_attributes/repo_derivation_queues:repo_derivation_queues",
        "//eden/mononoke/repo_attributes/repo_derived_data:repo_derived_data",
        "//eden/mononoke/repo_attributes/repo_identity:repo_identity",
        "//eden/mononoke/repo_attributes/repo_lock:repo_lock",
        "//eden/mononoke/repo_attributes/sql_query_config:sql_query_config",
        "//eden/mononoke/repo_factory:repo_factory",
        "//eden/mononoke/scs/if:source_control-rust",
        "//eden/mononoke/server/context:context",
        "//eden/scm/lib/renderdag:renderdag",
        "//thrift/lib/rust:fbthrift",
    ] + ([] if rust_oss.is_oss_build() else [
        "fbsource//third-party/rust:serde",
        "//common/rust/shed/justknobs_stub:justknobs",
        "//common/rust/mysql:mysql_client",
        "//eden/mononoke/blobstore:blobstore_factory",
        "//eden/mononoke/blobstore:fileblob",
        "//eden/mononoke/blobstore:redactedblobstore",
        "//eden/mononoke/facebook/git_server/push_poller/lib/command:command",
        "//eden/mononoke/common/facebook/sql_storage:sql_storage",
        "//eden/mononoke/repo_attributes/bonsai_blob_mapping:bonsai_blob_mapping",
        "//eden/mononoke/repo_attributes/deletion_log:deletion_log",
    ]),
)
